﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="JYH.Web.MES.Login" %>



<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<%--    <title runat="server" meta:resourcekey="txtTitle"></title>--%>
        <title id="title1"></title>
    <link rel="stylesheet" type="text/css" href="../themes/uimaker/easyui.css" />
    <link rel="stylesheet" type="text/css" href="css/uimaker.css" />
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="js/jparticle.jquery.min.js"></script>
   <script type="text/javascript" src="js/JYH.Core.js"></script>
    <script type="text/javascript" src="js/Public.js"></script>
</head>
<body style="background: #252D47; overflow: hidden;">

    <form runat="server">
    <!--loginbg start-->
    <div class="loginbg">

        <!--login start-->
        <div class="login">

            <!--loginbox start-->
            <div class="loginbox">

                <div class="loginleft"><%--<h2>通鑫益</h2>--%></div>

                <div class="loginright">

                    <span class="loginlogo"></span>

                    <ul class="userlogin">
                        <li>
                            <p class="loginuser"><i class="iconfont">&#xe602;</i></p>
                            <cite>
                                <input class="easyui-textbox" style="width: 100%; height: 40px;" runat="server" id="txtUserName"/>
                            </cite></li>
                        <li>
                            <p class="loginpassword"><i class="iconfont">&#xe616;</i></p>
                            <cite>
                                <input class="easyui-textbox" style="width: 100%; height: 40px;" runat="server" id="txtPwd" type="password"/>
                            </cite>

                        </li>
                        <li>
                            
                               
                             <%--   Text="<%$ Resources:Language, btnLogin %>" OnClientClick="LoginIn()" CssClass="loginbtn" />--%>
                          
                                <a class="loginbtn" href="javascript:void(0)" id="loginbtn"  runat="server" onclick="LoginIn()" >登 录 </a>
                            <%--<asp:Button runat="server" Text="登录" CssClass="loginbtn" onserverclick="btnLogin_Click" ID="loginbtn"/>--%>

                        </li>
                        <li><em>
                            <input class="easyui-checkbox" name="fruit" value="Apple" /></em><b id="b1"></b></li>
                    </ul>

                </div>

            </div>
            <!--loginbox end-->

            <div class="loginshadow"></div>

        </div>
        <!--login end-->

        <div class="loginfooter">CopyRight 2024&nbsp;&nbsp;版权所有&nbsp;&nbsp;江苏捷易晧智能设备科技有限公司</div>

    </div>
    <!--loginbg end-->
    </form>

    <script>


       
        $(function () {
            $(".loginbg").jParticle({
                background: "#252D47",
                color: "#fff"
            });
        
            var abc = {
                PageName: 'Login',
                LanguageNO: navigator.language
            };
            var res;
            

            fetch('/api/SYS/GetPageLanguage', {
                method: 'POST', // 或者其他HTTP方法
                headers: {
                    'Content-Type': 'application/json'
                },
                body: JSON.stringify(abc) // 如果是POST或PUT请求，需要包含数据
            })
                .then(response => {
                    // 处理响应
                    if (!response.ok) {
                        throw new Error('Network response was not ok');
                    }
                    return response.json(); // 解析JSON响应体
                })
                .then(data => {

                    res = data.Items[0];
                    if (res != null)
                    {
                        document.getElementById("loginbtn").textContent = res.BtnLogin;
                        document.title = res.PageTitile;
                        document.getElementById("b1").textContent = res.TxtRemember;
                    }
                   // document.getElementById("title1").textContent = res.PageTitile;
          
             
                    // 处理数据
                })
                .catch(error => {
                    console.error('There has been a problem with your fetch operation:', error);
                });
           


        });
        //设置div高度自适应浏览器
        $(window).resize(function (e) {
            $(".loginbg").height($(window).height());
        }).resize();
         
         function LoginIn() {
            if ($("#txtUserName").val() == "") {
               
                Notice("Please Input UserNO.");
                $("#txtUserName").focus();
                return false;
            }
            if ($("#txtPwd").val() == "") {
                Notice("Please Input Password.");
                $("#txtPwd").focus();
                return false;
            }
             var UserNO = $("#txtUserName").val();
             var Pwd = $("#txtPwd").val();
            try {
                // 调用WebAPI登录接口
                var abc = {
                    UserNO: UserNO,
                    Pwd: Pwd
                };
                
                var url = "api/SYS/Login";
                DataService.AjaxPost(url, abc, function ( data) {
                    if (data.Code == 200) {

                        window.location.href = "Index.aspx";
                    }
                    if (data.Code == 500) {
                        Notice(data.Message);

                    }
                });
            } catch (error) {
                console.error('登录过程中发生错误:', error);
                alert('登录过程中发生错误，请稍后再试');
            }
  
        }
        
    </script>

</body>
</html>
